//
//  DJTool.h
//  ETC_ios
//
//  Created by xinrui on 2017/12/13.
//  Copyright © 2017年 xinrui. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface DJTool : NSObject
//1. 验证邮箱
+ (BOOL)validateEmail:(NSString *)email;

//2. 验证手机和座机
+ (BOOL)valiMobile:(NSString *)mobileNum;

//3. 验证车牌号
+ (BOOL)validateCarNo:(NSString *)carNo;


//4. 判断字符串中是否含有空格
+ (BOOL)isHaveSpaceInString:(NSString *)string;


//5. 判断字符串中是否含有中文
+ (BOOL)isHaveChineseInString:(NSString *)string;

//6. 判断身份证格式
+ (BOOL)checkIdentityCardNo:(NSString*)value;


#pragma mark-------      缓存相关
//7. 缓存计算  转换B/KB/MB/GB
+(NSString *)SetCacheSize:(unsigned long long)fileSize;

//8.  清空缓存
+(BOOL)CleanCacheFilePath;

//9、获取字符串（或汉字）首字母
+ (NSString *)firstCharacterWithString:(NSString *)string;

//10. 将字符串数组按照元素首字母顺序进行排序分组
+ (NSDictionary *)dictionaryOrderByCharacterWithOriginalArray:(NSArray *)array;



#pragma marrk--- 时间相关
// 11 .获取当前时间
+ (NSString* )currentDateWithFormat:(NSString *)format;

// 12 .计算上次日期距离现在多久，如XX小时前、XX分钟前等

/**
 *  计算上次日期距离现在多久
 *
 *  @param lastTime    上次日期(需要和格式对应)
 *  @param format1     上次日期格式
 *  @param currentTime 最近日期(需要和格式对应)
 *  @param format2     最近日期格式
 *
 *  @return xx分钟前、xx小时前、xx天前
 */


+ (NSString *)timeIntervalFromLastTime:(NSString *)lastTime lastTimeFormat:(NSString *)format1  ToCurrentTime:(NSString *)currentTime currentTimeFormat:(NSString *)format2;

+ (NSString *)timeIntervalFromLastTime:(NSDate *)lastTime ToCurrentTime:(NSDate *)currentTime;


#

// 15. 判断字符串中是否含有某个字符串
+ (BOOL)isHaveString:(NSString *)string1 inString:(NSString *)string2;

//16、判断字符串是否全部为数字
+ (BOOL)isAllNum:(NSString *)string;



// 17. 事件字符串转NSDate  格式：yyyy-MM-dd hh:mm:ss
+ (NSDate*)DateFromString:(NSString*)uiDate;


//18. 获取设备当前网络IP地址
+ (NSString *)getIPAddress:(BOOL)preferIPv4;


#pragma mark----------   获取指定路径相关
// 19. 获取指定路径下某个文件的大小
+ (long long)fileSizeAtPath:(NSString *)filePath;


//20. 获取文件夹下所有文件的大小
+ (long long)folderSizeAtPath:(NSString *)folderPath;


#pragma  mark--------   磁盘相关

+ (NSString*)dictionaryToJson:(NSDictionary *)dic;

+(NSString*)getCurrentTimes;


//23.验证售机号码的正则表达式
+ (BOOL)valiMobileText:(NSString *)mobile;

//验证车辆的vin
+(BOOL)judgePassWordLegal:(NSString *)pass;

//时间戳变为格式时间
+(NSString *)ConvertStrToTime:(NSString *)timeStr;

//获取星期几
+ (NSString *) getweekDayStringWithDate:(NSDate *) date;

//获取当前时间戳(秒)
+(NSString *)getNowTimeTimestamp;


//获取当前时间戳  （以毫秒为单位）
+(NSString *)getNowTimeTimestamp2;

// 根据颜色生成UIImage

+(UIImage*)imageWithColor:(UIColor*)color;

+ (BOOL) justPassword:(NSString *)passWord;

+ (void)afterTime:(float)time Action:(void(^)(void))action;

+ (NSString *)convertToJsonData:(id)object;


//解压文件
+ (void)releaseZipFilesWithUnzipFileAtPath:(NSString *)zipPath Destination:(NSString *)unzipPath;

// 读取本地JSON文件
+ (NSDictionary *)readLocalFileWithName:(NSString *)name;


+(NSString *)filterHTML:(NSString *)html;


/** 本地存储 */
+ (void)saveUserdefultValue:(id)value forKey:(NSString *)fileName;
/** 本地取值 */
+(id)getUserdefultforKey:(NSString *)fileName;
/** 本地删除 */
+(void)deleteUserdefultforKey:(NSString *)fileName;
/** URL地址转化为图片 */
+(UIImage *)getImageFromURL:(NSString *)fileURL;
@end
